//echarts参数配置
export const eOption = bins => {
	let option = {
		
		tooltip: {
			trigger: 'axis',
			axisPointer: {
				type: 'cross',
				crossStyle: {
					color: '#999'
				}
			}
		},
		color: ['#03b8ed','red','black','blue','yellow'],
		toolbox: {
			feature: {
				dataView: { show: true, readOnly: false },
				magicType: { show: true, type: ['line', 'bar'] },
				restore: { show: true },
				saveAsImage: { show: true }
			}
		},
		legend: {
			data: ['第一次预测', '第二次预测'],
			orient: 'horizontal',
			y: 'bottom',
		},
		grid: {
			left: '50px',
			right: '50px',
			bottom: '50px',
			containLabel: true
		},
		xAxis: [{
			type: 'value',
			//这个一定要设，不然barWidth和bins对应不上
			scale: true,
			name: '区间',
		}],
		yAxis: [{
			type: 'value',
			name: '数量',
		}],
		series: [{
			type: 'bar',
			name:"第一次预测",
			label: {
				normal: {
					show: false,
					position: 'insideTop',
					formatter: function(params) {
						return params.value[1];
					}
				}
			},
			data: bins.data
		},{
			type: 'bar',
			name:"第二次预测",
			label: {
				normal: {
					show: false,
					position: 'insideTop',
					formatter: function(params) {
						return params.value[1];
					}
				}
			},
			data: bins.data
		}]
	};
	return option;
}

//获取大仓
export const getCabinCode = data => {	
	let arr = [];
	for(let i of data){
		arr.push(i.cabinCode);
	}
	return arr;
}